package com.jackrain.nea.clould.dao;

import com.jackrain.nea.clould.model.ONSSendMonitorMQBodyModel;
import com.jackrain.nea.web.query.QueryEngine;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.sql.Timestamp;
import java.util.Date;

/**
 * 查询Topic
 */
@Slf4j
@Component
public class ONSSendMontitorMQBodyDao {


    public int insert(ONSSendMonitorMQBodyModel onsSendMonitorMQBodyModel) {

        String sql = "insert into ONS_SENDMONITOR_MQBODY " +
                "(id,ad_client_id, ons_sendmonitor_id,ABSTRACT1," +
                "ABSTRACT2,ABSTRACT3,msgKey," +
                "ownerid,modifierid,creationdate,modifieddate,isactive)" +
                "values(?,?,?,?," +
                "?,?,?," +
                "?,?,?,?,?) " +
                "ON DUPLICATE KEY UPDATE modifieddate = ?";

        Timestamp time = new Timestamp(new Date().getTime());

        int ret = QueryEngine.getInstance().executeUpdate(sql, new Object[]{com.jackrain.nea.core.db.Tools.getSequence("ONS_SENDMONITOR_MQBODY"),
                onsSendMonitorMQBodyModel.getAd_client_id(), onsSendMonitorMQBodyModel.getOns_sendmonitor_id(), onsSendMonitorMQBodyModel.getAbstract1(),
                onsSendMonitorMQBodyModel.getAbstract2(),  onsSendMonitorMQBodyModel.getAbstract3(),onsSendMonitorMQBodyModel.getMsgKey(),
                893, 893, time, time, "Y", time});


        return ret;

    }


}
